package com.woniuxy.dao;

import com.woniuxy.entity.Student;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author 猪猪
 * @create 2021-09-29 22:24
 */
public interface StudentDao {
    public void insertStudent(Student student);
    public void insertStudentGetId(Student student);
    public void updateStudent(Student student);
    public void deleteStudent(int id);
    public Student selectStudentById(int id);
    public List<Student>selectAllStudents();
    List<Student>selectAllStudentsByName(String name);

    //多参数
    List<Student>selectAllStudentsByNameAge(@Param("name") String name,@Param("age") int age);
    void insertStudent01(@Param("student") Student student);
    List<Student>selectStudentsByParameter(@Param("name") String name,@Param("age") int age,
                                           @Param("student") Student student);
     //动态参数(if)
    List<Student> selectStudentByIf(Student student);
    //where
    List<Student> selectStudentsByWhere(Student student);
    //二选一if-else，多选一 if-else if-else if-else
    List<Student> selectStudentsChoose(Student student);

    //Foreach
    //Array数组
    List<Student> selectStudentsForeachArray(int[] ids);
    //ForeachList(集合)
    List<Student> selectStudentsByForeachList(List<Integer> ids);
    //ForeachListStduent(集合对象)
    List<Student> selectStudentsByForeachListStduent(List<Student> students);

    //分页
    //获取分页查询的总数条数
    public int selectStudentsCountByConditionPage(@Param("student")Student student);

    /*分页数据
      @Param("student") Student student 查询条件
      @Param("pageIndex") int pageIndex 当前页
      @Param("pageSize") int pageSize 页大小
     * */
    List<Student>selectStudentsByConditionPage(@Param("student") Student student,
                                               @Param("pageIndex") int pageIndex,
                                               @Param("pageSize") int pageSize);
}